perf(multichain-account-service): add Solana account batching#8131
perf(multichain-account-service): add Solana account batching#8131ccharly wants to merge 59 commits intocc/feat/backup-and-sync-batchfrom
Conversation
This reverts commit cb0e654.
2b8e426 to
716a57a
Compare
716a57a to
16a70a6
Compare
6d1259e to
99d0aa2
Compare
18c070d to
05ecd6a
Compare
25d09e4 to
957ea19
Compare
6fd4e76 to
fb482ca
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| ); | ||
|
|
||
| // Group indices are sequential, so we just need the starting index. | ||
| groupIndexOffset = options.range.from; |
There was a problem hiding this comment.
Undefined range.from causes NaN group indices
High Severity
groupIndexOffset = options.range.from doesn't handle the optional from field. The GroupIndexRange type defines from as from?: number, so when omitted, groupIndexOffset becomes undefined. This causes groupIndexOffset + index to evaluate to NaN, producing invalid derivation paths like m/44'/501'/NaN'/0' and incorrect groupIndex values in the entropy metadata. A nullish coalescing default like ?? 0 is needed, consistent with how from is handled elsewhere (e.g., toGroupIndexRangeArray and assertGroupIndexRangeIsValid both default from to 0).
Additional Locations (1)
There was a problem hiding this comment.
This range.from comes from the keyring API, it cannot be undefined (at least, type-wise, we do not expect it to be undefined)
packages/multichain-account-service/src/providers/SnapAccountProvider.ts
Outdated
Show resolved
Hide resolved
fb482ca to
20605ec
Compare
957ea19 to
222e1eb
Compare


Explanation
Implementing proper batching for our Solana account provider.
References
:createMultichainAccountGroupsaction to batch account creation #7801Checklist
Note
Medium Risk
Changes Solana account creation to use a new batch Snap keyring API and adjusts how BIP-44 entropy metadata is synthesized, which could impact account derivation/indexing and timeouts if the Snap/keyring behavior differs from expectations.
Overview
Solana account creation is now batched.
SolAccountProvider.createAccountsswitches from per-accountcreateAccountcalls (looping for ranges) to a singleSnapKeyring.createAccountscall for both single-index and range creation, reducing keyring locking/API overhead.To support this,
SnapAccountProvider’s restricted keyring surface now exposescreateAccounts, and the Solana provider maps returned Snap accounts to BIP-44 accounts by injectingentropy/derivationPathbased on the requested indices before asserting compatibility and tracking created IDs.Tests and mocks were updated to expect the batch API (and not the singular call), and a small helper
toGroupIndexRangeArraywas added for range-based test keyring behavior; changelog updated to note the optimization.Written by Cursor Bugbot for commit 20605ec. This will update automatically on new commits. Configure here.